//
// Created by ECNU on 2024/2/22.
//

#ifndef NANO_FAISS_INDEXFLATCODES_H
#define NANO_FAISS_INDEXFLATCODES_H

#include <nanofaiss/Index.h>
#include <vector>

namespace faiss {

/** Index that encoded all vectors as fixed-size code(size code_size),
 * storage in vector */
struct IndexFlatCodes : Index {
    /// encoded code size
    size_t code_size;

    /// store encoded code
    std::vector<uint8_t> codes;

    IndexFlatCodes();

    IndexFlatCodes(size_t code_size, idx_t d, MetricType metric = MetricType::METRIC_L2);

    /// default add method, all derived class only need to overriede sa_encode method
    void add(idx_t n, const float *x) override;

    void reset() override;

    size_t sa_code_size() const override;


};

}

#endif // NANO_FAISS_INDEXFLATCODES_H
